import { createContext, useContext } from 'react'
import AppleStore from './AppleStore'

class RootStore {
  appleStore = new AppleStore()
}

const rootStore = new RootStore()
const RootStoreContext = createContext()

export const RootStoreProvider = ({ children }) => (
  <RootStoreContext.Provider value={rootStore}>
    {children}
  </RootStoreContext.Provider>
)

export const useRootStore = () => (
  useContext(RootStoreContext)
)